<?php
/**
 * Created by PhpStorm.
 * User: 1
 * Date: 2018/3/22
 * Time: 9:24
 */

namespace app\api\model;
use app\common\lib\exception\ApiException;
use think\Model;
use think\Log;

class BankAccount extends Model
{
    /**
     * 获取我的银行卡信息 Request:get
     * @param int user_id 用户id *必传
     * @author 王柯 <wangke.email@foxmail.com>
     * @return array|string|\think\response\Json
     */
    public function index(){
        $data = $_GET;

        if(!isset($data['user_id'])){
            throw new ApiException('user_id is not found！',404);
        }

        try{
            $result = $this->where('user_id='.$data['user_id'])->select();
            return show(config('code.success'),'ok',$result);
        }catch(\Exception $e){
            Log::write($e->getMessage());
            throw new ApiException($e->getMessage(),400);
        }

    }

}